#打印100以内 能被3和7整除的数字
for i in range(100):
    if i % 3 == 0 and i % 7 == 0:
        print(i)

#猜100以内的任意数字直到猜对为止
# import random
# num = random.randint(1,100)
# while True:
#     guess = int(input("请输入你猜测的数字："))
#     if guess == num:
#         print("恭喜你，猜对了！")
#         break
#     elif guess > num:
#         print("猜的数字太大了，再小一点吧！")
#     else:
#         print("猜的数字太小了，再大一点吧！")
#

#打印九九乘法表
for i in range(1,10):
    for j in range(1,i+1):
        print("%d * %d = %d" % (j,i,i*j),end="\t")
    print()


#打印水仙花数字
for i in range(100,1000):
    a = i // 100
    b = i // 10 % 10
    c = i % 10
    if a ** 3 + b ** 3 + c ** 3 == i:
        print(i)

#打印100以内的质数
for i in range(2,101):
    for j in range(2,i):
        if i % j == 0:
            break
    else:
        print(i)


#打印100以内的完数
for i in range(1,101):
    sum = 0
    for j in range(1,i):
        if i % j == 0:
            sum += j
    if sum == i:
        print(i)

#打印斐波那契数列 前39列
a,b = 0,1
for i in range(39):
    print(a,end=" ")
    a,b = b,a+b
    print()

#打印菱形
n = int(input("请输入菱形的边长："))

# 打印上半部分
for i in range(1, n + 1):
    print(' ' * (n - i), end='')
    print('*' * (2 * i - 1))

# 打印下半部分
for i in range(n - 1, 0, -1):
    print(' ' * (n - i), end='')
    print('*' * (2 * i - 1))

